#ifndef __STARTFACADE_H__
#define __STARTFACADE_H__

#include <set>
#include <string>

#include <boost/array.hpp>
#include <boost/smart_ptr.hpp>
#include <boost/asio.hpp>

namespace encrypted
{
    namespace tunnel
    {

        class SecretKeyGeneratedListener
        {
        public:
            virtual ~SecretKeyGeneratedListener();
            virtual void secretKeyGenerated(std::string secretKey) = 0;
        };

        class StartFacade
        {
        public:
            enum StartMode
            {
                ClientMode, ServerMode,
            };
            StartFacade();
            ~StartFacade();
            int addService( std::string listenPort,
                            std::string connectPort,
                            std::string connectIP,
                            StartMode mode = ClientMode,
                            std::string secretKey = "",
                            std::string bindHost = "",
                            unsigned int randSeed = 0,
                            unsigned int bandWidth = 102400);
            int start();
            void addSecretKeyGeneratedListener(boost::shared_ptr<SecretKeyGeneratedListener> listener);
            //const std::set<boost::shared_ptr<SecretKeyGeneratedListener> >& getSecretKeyGeneratedListeners();
            //void removeSecretKeyGeneratedListener(boost::shared_ptr<SecretKeyGeneratedListener> listener);
        private:
            boost::asio::io_service io_service;
            typedef std::set<boost::shared_ptr<SecretKeyGeneratedListener> > SecretKeyGeneratedListeners;
            SecretKeyGeneratedListeners secretKeyGeneratedListeners;
        };

    }
}

#endif
